# Figures 3 and 4

# Percent Change in Support Relative to Control:
isolated <- data.frame(
  purpose = c("Enhance", "Substitute", "Enhance", "Substitute", "Enhance", "Substitute"), 
  Domain = c("Cars", "Cars", "Social Media", "Social Media", "Drones", "Drones"), 
  support = c(t1_support_change, t2_support_change, t3_support_change, t4_support_change, t5_support_change, t6_support_change))
plot1 <- ggplot(isolated, aes(x=purpose, y = support, fill = Domain)) +
  geom_bar(stat="identity", position=position_dodge()) + 
  geom_text(aes(label = round(support, 2)), position = position_dodge(width = 1), vjust=1.5, size=3) +
  theme_bw() +
  scale_fill_manual(values=c("grey90", "grey70", "grey50")) +
  xlab("Purpose of AI-Enabled Technologies") +
  ylab("% Change in Support (Baseline - Control)")

# Percent Change in Trust Relative to Control:
isolated <- data.frame(
  purpose = c("Enhance", "Substitute", "Enhance", "Substitute", "Enhance", "Substitute"), 
  Domain = c("Cars", "Cars", "Social Media", "Social Media", "Drones", "Drones"), 
  trust = c(t1_trust_change, t2_trust_change, t3_trust_change, t4_trust_change, t5_trust_change, t6_trust_change))
plot2 <- ggplot(isolated, aes(x=purpose, y = trust, fill = Domain)) +
  geom_bar(stat="identity", position=position_dodge()) + 
  geom_text(aes(label = round(trust, 2)), position = position_dodge(width = 1), vjust=1.5, size=3) +
  theme_bw() +
  scale_fill_manual(values=c("grey90", "grey70", "grey50")) +
  xlab("Purpose of AI-Enabled Technologies") +
  ylab("% Change in Trust (Baseline - Control)")

ggarrange(plot1, plot2, ncol = 2, labels = c("Panel A", "Panel B"), font.label = list(size = 8),
          hjust=.02, common.legend = TRUE, legend = "bottom")

# Percent Change in Understanding Relative to Control:
isolated <- data.frame(
  purpose = c("Enhance", "Substitute", "Enhance", "Substitute", "Enhance", "Substitute"), 
  Domain = c("Cars", "Cars", "Social Media", "Social Media", "Drones", "Drones"), 
  understanding = c(t1_under_change, t2_under_change, t3_under_change, t4_under_change, t5_under_change, t6_under_change))
ggplot(isolated, aes(x=purpose, y = understanding, fill = Domain)) +
  geom_bar(stat="identity", position=position_dodge()) + 
  geom_text(aes(label = round(understanding, 2)), position = position_dodge(width = 1), vjust=-.5, size=3) +
  theme_bw() +
  scale_fill_manual(values=c("grey90", "grey70", "grey50")) +
  xlab("Purpose of AI-Enabled Technologies") +
  ylab("% Change in Understanding (Baseline - Control)")

